package com.yanqu.road.entity.activity.peakseacraft;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.union.UnionBaseInfo;

import java.math.BigInteger;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Description 海上争霸之南海丝路 联盟联盟信息
 */
@FieldTypeAnnotation(tableName = "t_c_activity_peak_seacraft_union")
public class PeakSeacraftCrossUnionData extends DataObject {
    @FieldTypeAnnotation(desc = "活动id", select = true, update = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "商会分组", select = true, update = true)
    private int unionGroup;
    @FieldTypeAnnotation(desc = "联盟id", update = true)
    private String unionId;
    @FieldTypeAnnotation(desc = "晋级到的轮次")
    private int round;
    @FieldTypeAnnotation(desc = "当前分组")
    private int groupNum;
    @FieldTypeAnnotation(desc = "当前分组排名")
    private int groupRank;
    @FieldTypeAnnotation(desc = "前一轮的排名")
    private int rank;
    @FieldTypeAnnotation(desc = "轮次结果")
    private Map<Integer, PeakSeacraftResultInfo> resultMap = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "捐献经验累计")
    private int totalDonationExp;
    @FieldTypeAnnotation(desc = "联盟成员id:position, 初始化船只数据的时候锁定成员")
    private Map<Long, Integer> memberMap = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "联盟成员 修复耐久信息")
    private Map<Long, PeakSeacraftFixDurableInfo> fixDurableMap = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "联盟信息")
    private UnionBaseInfo unionBaseInfo;
    @FieldTypeAnnotation(desc = "门客总赚钱")
    private BigInteger totalAbility = BigInteger.ZERO;
    @FieldTypeAnnotation(desc = "报名期排名")
    private int abilityRank;
    @FieldTypeAnnotation(desc = "累计积分")
    private int score;
    @FieldTypeAnnotation(desc = "所在海域")
    private int area;

    public PeakSeacraftCrossUnionData() {
    }

    public PeakSeacraftCrossUnionData(int activityId, int unionGroup, String unionId) {
        this.activityId = activityId;
        this.unionGroup = unionGroup;
        this.unionId = unionId;
        setInsertOption();
    }

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public String getUnionId() {
        return unionId;
    }

    public void setUnionId(String unionId) {
        if (unionId == null) {
            return;
        }
        if (this.unionId == null || !this.unionId.equals(unionId)) {
            this.unionId = unionId;
            setOp(DataStatus.Update);
        }
    }

    public int getRound() {
        return round;
    }

    public void setRound(int round) {
        if (this.round != round) {
            this.round = round;
            setOp(DataStatus.Update);
        }
    }

    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        if (this.rank != rank) {
            this.rank = rank;
            setOp(DataStatus.Update);
        }
    }

    public Map<Integer, PeakSeacraftResultInfo> getResultMap() {
        return resultMap;
    }

    public void setResultMap(ConcurrentHashMap<Integer, PeakSeacraftResultInfo> resultMap) {
        if (null == resultMap) {
            return;
        }
        if (this.resultMap == null || !this.resultMap.equals(resultMap)) {
            this.resultMap = resultMap;
            setOp(DataStatus.Update);
        }
    }

    public Map<Long, PeakSeacraftFixDurableInfo> getFixDurableMap() {
        return fixDurableMap;
    }

    public void setFixDurableMap(ConcurrentHashMap<Long, PeakSeacraftFixDurableInfo> fixDurableMap) {
        if (this.fixDurableMap == null || !this.fixDurableMap.equals(fixDurableMap)) {
            this.fixDurableMap = fixDurableMap;
            setOp(DataStatus.Update);
        }
    }

    public Map<Long, Integer> getMemberMap() {
        return memberMap;
    }

    public void setMemberMap(Map<Long, Integer> memberMap) {
        if (null == memberMap) {
            return;
        }
        if (this.memberMap == null || !this.memberMap.equals(memberMap)) {
            this.memberMap = memberMap;
            setOp(DataStatus.Update);
        }
    }
    public void updateMemberPosition(long userId, int position) {
        memberMap.put(userId, position);
        setUpdateOption();
    }

    public UnionBaseInfo getUnionBaseInfo() {
        return unionBaseInfo;
    }

    public void setUnionBaseInfo(UnionBaseInfo unionBaseInfo) {
        if (null == unionBaseInfo) {
            return;
        }
        if (this.unionBaseInfo == null || !this.unionBaseInfo.equals(unionBaseInfo)) {
            this.unionBaseInfo = unionBaseInfo;
            setOp(DataStatus.Update);
        }
    }

    public int getGroupNum() {
        return groupNum;
    }

    public void setGroupNum(int groupNum) {
        if (this.groupNum != groupNum) {
            this.groupNum = groupNum;
            setUpdateOption();
        }
    }

    public int getGroupRank() {
        return groupRank;
    }

    public void setGroupRank(int groupRank) {
        if (this.groupRank != groupRank){
            this.groupRank = groupRank;
            setUpdateOption();
        }
    }

    public int getTotalDonationExp() {
        return totalDonationExp;
    }

    public void setTotalDonationExp(int totalDonationExp) {
        if (this.totalDonationExp != totalDonationExp) {
            this.totalDonationExp = totalDonationExp;
            setUpdateOption();
        }
    }

    public BigInteger getTotalAbility() {
        return totalAbility;
    }

    public void setTotalAbility(BigInteger totalAbility) {
        if (this.totalAbility != totalAbility) {
            this.totalAbility = totalAbility;
            setUpdateOption();
        }
    }

    public int getAbilityRank() {
        return abilityRank;
    }

    public void setAbilityRank(int abilityRank) {
        if (this.abilityRank != abilityRank) {
            this.abilityRank = abilityRank;
        }
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        if (this.score != score) {
            this.score = score;
            setUpdateOption();
        }
    }

    public int getArea() {
        return area;
    }

    public void setArea(int area) {
        if (this.area != area) {
            this.area = area;
        }
    }

    public int getUnionGroup() {
        return unionGroup;
    }

    public void setUnionGroup(int unionGroup) {
        this.unionGroup = unionGroup;
    }
}
